package com.mandao.concurrency.example.singleton;

import com.mandao.concurrency.annotations.NotThreadSafe;
import com.mandao.concurrency.annotations.ThreadSafe;

/**
 *  饿汉式
 *      单例实例在 类加载时创建
 *
 *      考虑(资源浪费 加载慢)的可能
 */
@ThreadSafe
public class SingletonExample2 {
    private SingletonExample2(){}

    private static SingletonExample2 instance = new SingletonExample2();

    public static SingletonExample2 getInstance(){
        return instance;
    }
}
